//
//  HomePageDetailNoDataView.m
//  ShowYork
//
//  Created by hxh on 2021/2/24.
//  Copyright © 2021 hxh. All rights reserved.
//

#import "HomePageDetailNoDataView.h"

@interface HomePageDetailNoDataView ()
@property (nonatomic,strong)UIImageView *noDataImgView; /// 没有数据的提示页面图片
@property (nonatomic,strong)UIView *noDataView; /// 没有数据的提醒页面
@property (nonatomic,strong)UILabel *noDateLb; /// 没有数据的提示文案
@property (nonatomic,strong)UIButton *noDataBtn; /// 没有数据的返回按钮
@end

@implementation HomePageDetailNoDataView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setUI];
    }
    return self;
}

- (void)setUI{
    self.frame = CGRectMake(0, 0, kScreenW, kScreenH);
    self.hidden = YES;
    self.noDataView = [[UIView alloc]init];
    self.noDataView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.noDataView];
     
    [self.noDataView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.equalTo(self);
    }];
    
    self.noDataImgView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"mine_noList_tag"]];
    [self.noDataView addSubview:self.noDataImgView];
     
    [self.noDataImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self).offset(-kNavBarHeight);
        make.centerX.equalTo(self);
    }];
     
    self.noDateLb = [[UILabel alloc]init];
    self.noDateLb.text = @"无内容";
    self.noDateLb.textColor = C153;
    self.noDateLb.font = font(12);
    self.noDateLb.textAlignment = NSTextAlignmentCenter;
    [self.noDataView addSubview:self.noDateLb];
    [self.noDateLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.noDataView);
        make.top.equalTo(self.noDataImgView.mas_bottom).offset(12);
    }];
     
    self.noDataBtn = [[UIButton alloc]init];
    [self.noDataBtn setImage:[UIImage imageNamed:@"common_close_tag"] forState:UIControlStateNormal];
    [self.noDataBtn setImage:[UIImage imageNamed:@"common_close_tag"] forState:UIControlStateHighlighted];
    [self.noDataBtn addTarget:self action:@selector(removeMethod) forControlEvents:UIControlEventTouchUpInside];
    [self.noDataView addSubview:self.noDataBtn];
     
    [self.noDataBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.noDataView).offset(16);
        make.top.equalTo(self.noDataView).offset(GK_STATUSBAR_HEIGHT + 12);
    }];
}

- (void)removeMethod{
    if (self.delegate && [self.delegate respondsToSelector:@selector(noDataBackMethod)]) {
        [self.delegate noDataBackMethod];
    }
}


@end
